#include <iostream>
#include <cstdio>

void atoi(char *str)
{
    int value = 0;
    for (int i = 0; str[i] != '\0'; i++)
    {
        value = value * 10 + (str[i] - '0');
    }
    std::cout<<value<<std::endl;
}

void atof(char *s)
{
    double value1 = 0;
    double value2 = 0;
    double value = 0;
    int i = 0;
    while (s[i] == ' ')
    {
        i++; // 跳过空格
    }
    while (s[i] <= '9' && s[i] >= '0')
    {
        value1 = value1 * 10 + (s[i] - '0');
        i++;
    }
    if (s[i] == '.')
    {
        i++;
        double Dempla = 1.0;
        while (s[i] <= '9' && s[i] >= '0')
        {
            value2 = value2 * 10 + (s[i] - '0');
            Dempla *= 10;
            i++;
        }
        value2 /= Dempla;
    }
    value = value1 + value2;
    printf("%.5f",value);
    // std::cout<<value<<std::endl;
}

int main()
{
    char str[] = "  12388.289";
    atof(str);
    return 0;
}
